//=============================================================================
// Tripmine Weapon Pickup Superclass
//=============================================================================
class ChaosWeaponPickup extends UTWeaponPickup placeable;

var byte MyCount; 	         //Links to the weapon's Count, that tracks ammo types
var bool bMuiltAmmoWeapon;   // bool to set the mutli weapon poperties

//=============================================================================
// SpawnCopy
//=============================================================================
function inventory SpawnCopy( pawn Other )
{
	local inventory Copy;

    // check to see if its has Multi ammo abilities
    If (!bMuiltAmmoWeapon)
      return Super.SpawnCopy(other);

	if ( Inventory != None )
    {
		Copy = Inventory;
		Inventory = None;
	}
	else
		Copy = spawn(InventoryType,Other,,,rot(0,0,0));

     // Make shure the pick up does not come loaded with ammo already as ammo is hadned out elsewhere
    if (MyCount != 0)
	 ChaosWeapon(copy).SwitchFireMode(MyCount);
	//log("spawning new weapon type: " @copy);
    Copy.GiveTo( Other, self );
	return Copy;
}


//===========================================================================
// Pickup...the default state
// Due to the nature of the ChaosWeapons and how they use ammo, they dont respond to
// Epic's check to allow pickups with weapon stay with out a 'lil help below
auto state Pickup
{  	/* ValidTouch()
	 Validate touch (if valid return true to let other pick me up and trigger event).
	*/
	function bool ValidTouch( actor Other )
	{
	    local Inventory Inv;

        // make sure its a live player
		if ( (Pawn(Other) == None) || !Pawn(Other).bCanPickupInventory || (Pawn(Other).DrivenVehicle == None && Pawn(Other).Controller == None) )
			return false;

        // Check to see if the cuerrent Owner has the current weapon in their INV, If so
        // check to see if we can pick it up depending on the weapon stay rules....
        Inv=Pawn(Other).FindInventoryType(InventoryType);
        if (INV != None && !AllowRepeatPickup())
            Return False;

		// make sure not touching through wall
		if ( !FastTrace(Other.Location, Location) )
			return false;

		// make sure game will let player pick me up
		if( Level.Game.PickupQuery(Pawn(Other), self) )
		{
			TriggerEvent(Event, self, Pawn(Other));
			return true;
		}
		return false;
	}
}

defaultproperties
{
     DrawType=DT_StaticMesh
}
